// pages/news/news.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    jso: [],
    tiaojian: "",
    inputShowed: false,//搜索控件数据
    inputVal: "",//搜索控件数据
    qianhuo: true,//客户状态是否欠货
    qiankuan: false,//客户状态是否欠款
    shopid: ''//商户id
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    that.setData({
      shopid: wx.getStorageSync("shopid")
    })
    console.log(that.data.shopid);
    wx.request({
      url: 'https://www.wenzhixinxi.com/phptest/orderby_atoz.php', //你的后台地址
      data: {
        shopid: that.data.shopid
      },
      header: {
        'content-type': 'application/json'
      },
      success: function (res) {
        that.setData({
          qiankuan: true,
          qianhuo: true
        })
        var jso = res.data.jsonObj;
        console.log(res);
        console.log("data=" + res.data);
        that.setData({
          jso: jso,
        })
        console.log("jso=" + jso);
      }
    })
  },

  onItemClick: function (e) {//点击新闻跳转页面
    console.log(e.currentTarget.dataset.idx)
    var kuanhao = e.currentTarget.dataset.idx
    wx.navigateTo({
      url: '../sell_createorder/sell_createorder?kuanhao='+kuanhao,
      success: function(res) {

      },
      fail: function(res) {},
      complete: function(res) {},
    })
  },

  getmsg: function (e) {
    console.log("121" + e.detail.value)
    this.setData({
      tiaojian: e.detail.value
    })
    console.log(this.data.tiaojian)
  },

  search: function () {//搜索页面
    console.log("输入的数据" + this.data.tiaojian)
  },

  //搜索控件事件
  showInput: function () {
    this.setData({
      inputShowed: true
    });
  },
  hideInput: function () {
    this.setData({
      inputVal: "",
      inputShowed: false
    });
  },
  clearInput: function () {
    this.setData({
      inputVal: ""
    });
  },
  inputTyping: function (e) {
    this.setData({
      inputVal: e.detail.value
    });
  }
})